package cn.pconline.security2.authentication;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;

/**
 * Copyrights 2005, Guangzhou Intellisoft ltd.
 * User: chen xiaohu
 * Date: 2005-12-9
 * Time: 14:42:09
 */
public class SelectUserServlet extends HttpServlet {
	@Override
    public void init() throws ServletException {
        Client.init();
    }

	@Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=GBK");
        procUserList(request, response);
    }

    private void procUserList(HttpServletRequest request, HttpServletResponse response) throws IOException {
        int areaId = 0;
        int dept = 0;
        try {
            areaId = Integer.parseInt(request.getParameter("areaId"));
            dept = Integer.parseInt(request.getParameter("departmentId"));
        } catch(Exception e) {
            // do nothing
        }
        response.getWriter().println(Client.getUserListHtml(areaId, dept));
    }

}
